#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
	int n,i,j;
    while(~scanf("%d",&n))
	{
        int **p,flag=0;
        p = (int **)calloc(n,sizeof(int *));//n行
        for (int i = 0; i < n; i++)//n行
        {
	 	  p[i] = (int *)calloc(n,sizeof(int));//n列
	    }

            for ( i = 0; i < n; i++)
            for ( j = 0; j < n; j++)
            scanf("%d", &p[i][j]);
            for ( i = 0; i < n; i++)
            for ( j = i; j < n; j++)
            {
                if(p[i][j]==p[j][i])
                    flag = flag + 0;
                else
                    flag = flag + 1;
            }

            if(flag==0)
                printf("Yes\n");
            else
                printf("No\n");
        free(p);
    }
	return 0;
}
